package com.stark.lab.covid19statistics.config;

import com.stark.lab.covid19statistics.util.DataUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.io.IOException;

@Configuration
@EnableScheduling
public class StatsScheduleTask {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    DataUtil dataUtil;

    //每隔10分钟刷新一次
    @Scheduled(cron = "0 */10 * * * ?")
    private void configureTasks() {
        dataUtil.refreshData();
    }
}